package foo.bar.db.Dao.impl;

import foo.bar.db.Dao.PersonDao;
import foo.bar.db.entity.Employee;
import foo.bar.db.entity.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoOperations;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
public class MongoPersonDao implements PersonDao {

    @Autowired
    MongoOperations operations;

    @Override
    public void save(Person employee) {
        operations.save(employee);
    }

    @Override
    public void update(Person person) {
        operations.updateFirst(person);
    }


    @Override
    public List<Person> findAll() {
        return operations.findAll(Person.class);
    }


}
